---
category: Date Time
created: '2020-05-21'
title: Get the yesterday date
updated: '2021-10-13'
---

**JavaScript version**

```js yesterday.js
const yesterday = ((d) => new Date(d.setDate(d.getDate() - 1)))(new Date());

// Or
const yesterday = new Date(new Date().valueOf() - 1000 * 60 * 60 * 24);
```

**TypeScript version**

```ts yesterday.ts
const yesterday: Date = ((d) => new Date(d.setDate(d.getDate() - 1)))(new Date());

// Or
const yesterday: Date = new Date(new Date().valueOf() - 1000 * 60 * 60 * 24);
```

## See also

-   [Determine one year from now](https://phuoc.ng/collection/1-loc/determine-one-year-from-now/)
-   [Get the tomorrow date](https://phuoc.ng/collection/1-loc/get-the-tomorrow-date/)
